package com.project.evaluation.service;


import com.project.evaluation.entity.Project;
import com.project.evaluation.mapper.ProjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ProjectService {
     @Autowired
    private ProjectMapper projectMapper;

        @Transactional
    public boolean addProject(Project project) {
        return projectMapper.insertProject(project) > 0;
    }
  public List<Project> getProjectList() {
        return projectMapper.selectProjects();
    }
@Transactional
    public boolean deleteProjectById(int projectId) {
        return projectMapper.deleteProjectById(projectId) > 0;
    }
@Transactional
    public boolean updateProject(Project project) {
        return projectMapper.updateProject(project) > 0;
    }
    public List<Project> searchByProjects(String projectName) {


        Map<String, Object> params = new HashMap<>();

        return projectMapper.searchProjects(projectName);
    }
}
